<?php
     $time = sprintf("%.5f", microtime(true));
     global $cache,$db,$afdebug;
     /*
     printNodes.php - This utility is ran from the command line.
     php printNodes.php
     */
     require_once('inc/conf.inc.php');
     $bcms = new bcms();

     if(isset($argv[1])) {
        $res = $bcms->getNodeList($argv[1],$argv[2]);
     } else {
        $res = $bcms->getNodeList();
     }

    echo "Usage: php $argv[0] <offset> <limit>\n";
    echo "|id | key           | timestamp            | auth_id | visible |\n";
    echo "|--------------------------------------------------------------|\n";

     foreach ($res as $key => $value) {
        echo "|";
        foreach ($value as $skey => $svalue) {
            if($skey == 'key') { $pad = 14; }
            elseif($skey == 'timestamp') { $pad = 21; }
            elseif($skey == 'id') { $pad = 3; }
            else { $pad = 8; }
            echo str_pad ($svalue,$pad) . "| ";
        }
        echo "\n";
     }

$qtime = sprintf("%.5f", microtime(true)-$time);
    echo "[!]runtime $qtime\n";
?>